package com.lzc.jobrecomendbackend.controller.overview;

import com.lzc.jobrecomendbackend.common.Result;
import com.lzc.jobrecomendbackend.model.overview.SummaryVO;
import com.lzc.jobrecomendbackend.model.overview.TotalJobsVO;
import com.lzc.jobrecomendbackend.service.overview.OverviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/overview")
public class OverviewController {

    @Autowired
    private OverviewService overviewService;

    /**
     * 获取职位总数
     * @return 职位总数数据
     */
    @GetMapping("/total_jobs")
    public Result<TotalJobsVO> getTotalJobs() {
        try {
            TotalJobsVO totalJobsVO = overviewService.getTotalJobs();
            return Result.success(totalJobsVO);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
    }

    /**
     * 获取核心数据概览
     * @return 概览数据
     */
    @GetMapping("/summary")
    public Result<SummaryVO> getSummary() {
        try {
            SummaryVO summaryVO = overviewService.getSummary();
            return Result.success(summaryVO);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
    }
} 